1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module sourceview.Mark; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import glib.c.functions; 30 private import gobject.ObjectG; 31 private import gtk.TextMark; 32 private import sourceview.c.functions; 33 public import sourceview.c.types; 34 35 36 /** 37 * Mark object for [class@Buffer]. 38 * 39 * A `GtkSourceMark` marks a position in the text where you want to display 40 * additional info. It is based on [class@Gtk.TextMark] and thus is still valid after 41 * the text has changed though its position may change. 42 * 43 * `GtkSourceMark`s are organized in categories which you have to set 44 * when you create the mark. Each category can have a priority, a pixbuf and 45 * other associated attributes. See [method@View.set_mark_attributes]. 46 * The pixbuf will be displayed in the margin at the line where the mark 47 * residents if the [property@View:show-line-marks] property is set to %TRUE. If 48 * there are multiple marks in the same line, the pixbufs will be drawn on top 49 * of each other. The mark with the highest priority will be drawn on top. 50 */ 51 public class Mark : TextMark 52 { 53 /** the main Gtk struct */ 54 protected GtkSourceMark* gtkSourceMark; 55 56 /** Get the main Gtk struct */ 57 public GtkSourceMark* getMarkStruct(bool transferOwnership = false) 58 { 59 if (transferOwnership) 60 ownedRef = false; 61 return gtkSourceMark; 62 } 63 64 /** the main Gtk struct as a void* */ 65 protected override void* getStruct() 66 { 67 return cast(void*)gtkSourceMark; 68 } 69 70 /** 71 * Sets our main struct and passes it to the parent class. 72 */ 73 public this (GtkSourceMark* gtkSourceMark, bool ownedRef = false) 74 { 75 this.gtkSourceMark = gtkSourceMark; 76 super(cast(GtkTextMark*)gtkSourceMark, ownedRef); 77 } 78 79 80 /** */ 81 public static GType getType() 82 { 83 return gtk_source_mark_get_type(); 84 } 85 86 /** 87 * Creates a text mark. 88 * 89 * Add it to a buffer using [method@Gtk.TextBuffer.add_mark]. 90 * If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved 91 * by name using [method@Gtk.TextBuffer.get_mark]. 92 * Normally marks are created using the utility function 93 * [method@Buffer.create_source_mark]. 94 * 95 * Params: 96 * name = Name of the #GtkSourceMark or %NULL 97 * category = is used to classify marks according to common characteristics 98 * (e.g. all the marks representing a bookmark could belong to the "bookmark" 99 * category, or all the marks representing a compilation error could belong 100 * to "error" category). 101 * 102 * Returns: a new #GtkSourceMark that can be added using [method@Gtk.TextBuffer.add_mark]. 103 * 104 * Throws: ConstructionException GTK+ fails to create the object. 105 */ 106 public this(string name, string category) 107 { 108 auto __p = gtk_source_mark_new(Str.toStringz(name), Str.toStringz(category)); 109 110 if(__p is null) 111 { 112 throw new ConstructionException("null returned by new"); 113 } 114 115 this(cast(GtkSourceMark*) __p, true); 116 } 117 118 /** 119 * Returns the mark category. 120 * 121 * Returns: the category of the #GtkSourceMark. 122 */ 123 public string getCategory() 124 { 125 return Str.toString(gtk_source_mark_get_category(gtkSourceMark)); 126 } 127 128 /** 129 * Returns the next `GtkSourceMark` in the buffer or %NULL if the mark 130 * was not added to a buffer. 131 * 132 * If there is no next mark, %NULL will be returned. 133 * 134 * If @category is %NULL, looks for marks of any category. 135 * 136 * Params: 137 * category = a string specifying the mark category, or %NULL. 138 * 139 * Returns: the next #GtkSourceMark, or %NULL. 140 */ 141 public Mark next(string category) 142 { 143 auto __p = gtk_source_mark_next(gtkSourceMark, Str.toStringz(category)); 144 145 if(__p is null) 146 { 147 return null; 148 } 149 150 return ObjectG.getDObject!(Mark)(cast(GtkSourceMark*) __p); 151 } 152 153 /** 154 * Returns the previous `GtkSourceMark` in the buffer or %NULL if the mark 155 * was not added to a buffer. 156 * 157 * If there is no previous mark, %NULL is returned. 158 * 159 * If @category is %NULL, looks for marks of any category 160 * 161 * Params: 162 * category = a string specifying the mark category, or %NULL. 163 * 164 * Returns: the previous #GtkSourceMark, or %NULL. 165 */ 166 public Mark prev(string category) 167 { 168 auto __p = gtk_source_mark_prev(gtkSourceMark, Str.toStringz(category)); 169 170 if(__p is null) 171 { 172 return null; 173 } 174 175 return ObjectG.getDObject!(Mark)(cast(GtkSourceMark*) __p); 176 } 177 }